<?php
namespace common\models\trade;
use common\models\BaseModel;
use common\models\finance\BalanceTypeModel;
/*
	兑换配置表

*/

class TradeGradeModel extends BaseModel
{

	public static function tableName()
	{
		return '{{%trade_grade}}';
	}

	public function rules()
	{
		return [
			[['grade','name'],'number'],
			[['name'],'string'],
		];
	}


	## 会员等级
	public static function gradeConf($lang='cn')
	{
		$data = self::find()->asarray()->all();
		if(!$data) return false;
		$list = array();
		foreach($data as $val)
		{
			$list[$val['grade']] = $lang=='en'?$val['en_name']:$val['name'];
		}
		return $list;
	}

}